<?php

namespace App;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\Redis;

/**
 * App\BasicSetting
 *
 * @property int $id
 * @property string $type 类型
 * @property int $status 状态，0:隐藏，1:显示
 * @property \Illuminate\Support\Carbon|null $created_at
 * @property \Illuminate\Support\Carbon|null $updated_at
 * @method static \Illuminate\Database\Eloquent\Builder|\App\BasicSetting newModelQuery()
 * @method static \Illuminate\Database\Eloquent\Builder|\App\BasicSetting newQuery()
 * @method static \Illuminate\Database\Eloquent\Builder|\App\BasicSetting query()
 * @method static \Illuminate\Database\Eloquent\Builder|\App\BasicSetting whereCreatedAt($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\BasicSetting whereId($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\BasicSetting whereStatus($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\BasicSetting whereType($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\BasicSetting whereUpdatedAt($value)
 * @mixin \Eloquent
 */
class BasicSetting extends Model
{
    //
    public static function isShowVideo(){
//        $cache=Redis::get('not_show_video');
        $cache=false;
        if ($cache){
            return 1;
        } else {
            $isset = self::whereType('video')->first();
            if (!$isset){
                return 1;
            }
            if (!$isset->status)
                return 0;
            return 1;
        }
    }
}
